//
//  LoadingBaseViewController.m
//  NetMobileLocation
//
//  Created by Mehmet Sinan Şahin on 3/19/12.
//  Copyright (c) 2012 netgis. All rights reserved.
//

#import "LoadingBaseViewController.h"
#import "LoadingView.h"
#import "NGUtility.h"

@implementation LoadingBaseViewController

@synthesize loadingView;


#pragma mark - loading view methods

-(void)showActivityView {
    [self showActivityViewWith:TTLocalizedString(@"Loading...", @"") delay:100];
}

-(void)showActivityViewWith:(NSString *)loadingLabel delay: (int) delay {
    loadingView = [LoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0] loadingLabel:loadingLabel];
	
    
	[loadingView
     performSelector:@selector(removeView)
     withObject:nil
     afterDelay:100.0];
    
}


-(void)hideActivityView {
    [loadingView removeView];        
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc {
    //[loadingView release];
    [super dealloc];
}

@end
